﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BLL.Services.Televisors.Listing;

namespace BLL.Services.Televisors
{
    public class TelevisorsService:ITelevisorsService
    {
        private readonly TelevisorsCollection _televisorsCollection;

        public TelevisorsService(TelevisorsCollection televisorsCollection)
        {
            _televisorsCollection = televisorsCollection;
        }

        public void Insert(Televisor televisor)
        {
            _televisorsCollection.Create(televisor.Name, televisor.Type, televisor.Diagonal, televisor.TreeD,televisor.ReleaseDate,televisor.Avatar,televisor.MagazineId);
        }

        public void Update(Televisor televisor)
        {
            _televisorsCollection.Save(televisor.TelevisorId,televisor.Name,televisor.Type,televisor.Diagonal,televisor.TreeD,televisor.ReleaseDate,televisor.Avatar,televisor.MagazineId);
        }

        public TelevisorsListing Listing(int page, int size, string column, int direction, TelevisorsFilter filter)
        {
            return _televisorsCollection.Listing(page, size, column, direction, filter);
        }

        public Televisor GetById(int televisorId)
        {
            return _televisorsCollection.GetById(televisorId);
        }

        public void Delete(int televisorId)
        {
            _televisorsCollection.Delete(televisorId);
        }
    }
}
